﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NS_DBOP;

public partial class Flow_MyApprove : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            Bind();
        }
    }

    public void Bind()
    {
        int userid = Convert.ToInt32(new DBoperate().ExecuteScalar("select Employeeid from Employee where username='" + Session["UserName"] + "'"));
        string strsql = "select * from FlowDoc where ID in (select DocID from FlowPath where IsApprove<>2 and UserID=" + userid + ")";
        DataSet ds = new DBoperate().ExecuteQuery(strsql, 0, 0, "table1");
        DataView dv = ds.Tables[0].DefaultView;
        PagedDataSource pds = new PagedDataSource();
        AspNetPager1.RecordCount = dv.Count;
        pds.DataSource = dv;
        pds.AllowPaging = true;
        pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
        pds.PageSize = AspNetPager1.PageSize;
        this.GridView1.DataSource = pds;
        this.GridView1.DataBind();
        this.lblCount.Text = "共" + ds.Tables[0].Rows.Count + "条记录";
    }

    public string getFlow(string id)
    {
        string flow = new DBoperate().ExecuteScalar("select Name from Flow where ID=" + Convert.ToInt32(id)).ToString();
        return flow;
    }

    public string getUser(string id)
    {
        string user = new DBoperate().ExecuteScalar("select Name from Employee where Employeeid=" + Convert.ToInt32(id)).ToString();
        return user;
    }
    protected void AspNetPager1_PageChanged(object sender, EventArgs e)
    {
        Bind();
    }
}
